{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Weather map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook shows an example of use of the `AppLayout` template, which is documented in [Layout Templates](Layout%20Templates.ipynb) notebook. You can check that notebook for further explanation.\n", "\n", "This notebook depends on extra packages:\n", "\n", "* [bqplot](https://github.com/bloomberg/bqplot) - widget-based plotting library,\n", "* [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet) - cartography widget based on leaflet.js \n", "\n", "If you also would like to see a color weather map, you will need to obtain an API key from [OpenWeatherMap](https://openweathermap.org/)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": ["remove-cell"] }, "outputs": [], "source": [ "# Imports for JupyterLite\n", "%pip install -q ipywidgets ipyleaflet numpy bqplot pandas" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from ipyleaflet import Map, basemaps, basemap_to_tiles, Heatmap, TileLayer\n", "from ipywidgets import AppLayout\n", "from ipywidgets import HTML, Layout, Dropdown, Output, Textarea, VBox, Label\n", "import bqplot as bq\n", "import numpy as np\n", "from pandas import date_range" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To see map overlays obtain your API key free of charge from [OpenWeatherMap](https://openweathermap.org/) and paste it below." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OWM_API_KEY = \"PASTE_YOUR_OWM_API_KEY_HERE\" #openweathermap API key" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = Map(center=(52, 10), zoom=5, basemap=basemaps.OpenStreetMap.Mapnik)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "maps = {'Mapnik' : basemaps.OpenStreetMap.Mapnik,\n", " 'Esri' : basemaps.Esri.DeLorme}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "header = HTML(\"